﻿using dbe.FoundationLibrary.Windows.Extensions;

using System.Drawing;
using System.Windows.Forms;

namespace dbe.FoundationLibrary.Windows.Util
{
    /// <summary>
    /// 可以直接套用的事件处理函数类
    /// </summary>
    public class HandleEvent
    {
        /// <summary>
        /// 绘制线性渐变背景，Paint事件可直接套用
        /// 套用方法：
        ///     this.Paint += new PaintEventHandler(PaintLinearGradientBackground);
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void PaintLinearGradientBackground(object sender, PaintEventArgs e)
        {
            if (sender is Control control)
            {
                Graphics g = e.Graphics;
                Color FColor = Color.Blue;
                Color TColor = Color.White;
                g.FillLinearGradientBackgroundToRectangle(FColor, TColor, control.ClientRectangle);
            }
        }
    }
}